package edu.cuny.baruch.cis9590.library.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="patrons")
public final class Patron {
    
    private String address;
    private String city;
    private float fines;
    private int id;
    private String name;
    private String state;
    private int zip;
    
    public Patron() {
    }
    
    public Patron(String name, String address, String city, String state, int zip) {
        this.name = name;
        this.address = address;
        this.city = city;
        this.state = state;
        this.zip = zip;
        this.fines = 0.0f;
    }
    
    @Column(name="address")
    public String getAddress() {
        return address;
    }
    
    @Column(name="city")
    public String getCity() {
        return city;
    }
    
    @Column(name="fines")
    public float getFines() {
        return fines;
    }
    
    @Id
    @Column(name="patron_id")
    @GeneratedValue(generator="increment")
    @GenericGenerator(name="increment", strategy="increment")
    public int getId() {
        return id;
    }
    
    @Column(name="name")
    public String getName() {
        return name;
    }
    
    @Column(name="state")
    public String getState() {
        return state;
    }
    
    @Column(name="zip")
    public int getZip() {
        return zip;
    }
    
    public void setAddress(String address) {
        this.address = address;
    }
    
    public void setCity(String city) {
        this.city = city;
    }
    
    public void setId(int id) {
        this.id = id;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public void setState(String state) {
        this.state = state;
    }
    
    public void setZip(int zip) {
        this.zip = zip;
    }
    
	public void setFines(float fines) {
		this.fines = fines;
	}
	
	@Override
	public String toString() {
	    return name;
	}
}
